<template>
  <div class="home">
    <el-container>
      <el-header class="top-title">欢迎您! <span style="margin-left:70%">当前管理员：{{name}}</span></el-header>
      <el-container>
        <el-aside width="230px">
          <el-menu :default-openeds="['1','2','3']">
            <el-submenu index="1">
              <template slot="title"><i class="el-icon-message"></i>用户资料管理</template>
              <el-menu-item-group>
                <router-link :to="{path:'/home'}"><el-menu-item index="1-1">用户信息</el-menu-item></router-link>
              </el-menu-item-group>
            </el-submenu>
            <el-submenu index="2">
              <template slot="title"><i class="el-icon-menu"></i>动态相关管理</template>
              <el-menu-item-group>
                  <router-link :to="{path:'/share'}"><el-menu-item index="2-1">动态管理</el-menu-item></router-link>
                <router-link :to="{path:'/remark'}"><el-menu-item index="2-2">评论管理</el-menu-item></router-link>
              </el-menu-item-group>
            </el-submenu>
          </el-menu>
        </el-aside>
        <el-main>
          <slot></slot>  
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script>
  import { mapMutations } from "vuex";
  // @ is an alias to /src

  export default {
    name: 'Home',
    data() {
      return {
        name:''
      }
    },
    created(){
      this.name = window.sessionStorage.getItem("name")
    },
    methods: {
      ...mapMutations(['delToken']),
      outLogin() {
        this.delToken({ token: '' });
        this.$router.push('/login');
      }
    },
  }
</script>

<style>
  body {
    padding: 0;
    margin: 0;
  }
  a{
    color: black
  }
  .el-header,
  .el-footer {
    background-color: #363d47;
    color: #333;
    text-align: center;
    line-height: 60px;
  }

  .el-aside {
    background-color: #363d47;
    color: #333;
    text-align: center;
    line-height: 200px;
    height: 650px;
  }

  .el-main {
    background-color: #E9EEF3;
    color: #333;
    text-align: center;
    line-height: 0px;
    height: 650px;
  }

  body>.el-container {
    margin-bottom: 40px;
  }

  .el-container:nth-child(5) .el-aside,
  .el-container:nth-child(6) .el-aside {
    line-height: 260px;
  }

  .el-container:nth-child(7) .el-aside {
    line-height: 320px;
  }
.top-title{
  color: #f9f9f9;
  text-align: left;
  font-size: 20px;
}
.el-menu-item{
  color:black ;
}
.el-menu-item-group__title{
  padding: 0;
}
.el-submenu,.el-menu-item-group{
  background-color: white;
}
</style>